package appapi.service.impl;

import appapi.Request.ModuletypeReq;
import appapi.dao.ModuletypeMapper;
import appapi.entity.auth.ModuletypeEntity;
import appapi.service.ModuletypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 模块类别
 *
 * @author lc
 * @version 1.0
 * @date 2023-05-17 10:08:27
 */
@Service
public class ModuletypeServiceImpl extends ServiceImpl<ModuletypeMapper, ModuletypeEntity> implements ModuletypeService {

    @Autowired
    private ModuletypeMapper moduletypeMapper;

    @Override
    public List<ModuletypeEntity> list(ModuletypeReq moduletypeReq) {
        return moduletypeMapper.list(moduletypeReq);
    }

    @Override
    public ModuletypeEntity detail(Long moduTypeId) {
        return moduletypeMapper.detail(moduTypeId);
    }

    @Override
    public int count(ModuletypeEntity moduletypeEntity) {
        return moduletypeMapper.count(moduletypeEntity);
    }

    @Override
    public int insert(ModuletypeEntity moduletypeEntity) {
        return moduletypeMapper.insertModuleType(moduletypeEntity);
    }

    @Override
    public int update(ModuletypeEntity moduletypeEntity) {
        return moduletypeMapper.updateModuleType(moduletypeEntity);
    }

    @Override
    public int delete(Long moduTypeId) {
        if(moduletypeMapper.aollowDeleteModuleType(moduTypeId)>0)
        {
            return  -1;
        }
        return moduletypeMapper.deleteModuleType(moduTypeId);
    }
}
